WndProc proc hWin:DWORD,localMsg:DWORD,wParam :DWORD,lParam :DWORD
        local hDC:HDC
        local tm:TEXTMETRIC
        local ps:PAINTSTRUCT
        local i:SDWORD,x:SDWORD,y:SDWORD,iVertPos:SDWORD,iHorzPos:SDWORD,iPaintBeg:SDWORD,iPaintEnd
        local scroll_info:SCROLLINFO
        local szBuffer[10]:BYTE
        local nFlags:DWORD,zDelta:WORD,pt:POINT
    .if localMsg==WM_CREATE
		invoke GetDC,hWin
		mov hDC,eax
		invoke GetTextMetrics,hDC,ADDR tm
		mov eax,tm.tmAveCharWidth
		mov cxChar,eax
		;cxCaps =(tm.PitchAndFamily & 1 ? 3 : 2)*cxChar/ 2;
		mov al,byte ptr tm.tmPitchAndFamily
		and eax,1
		je @FALSE1;假则取值3
		mov eax,3;真则取值2
		jmp @TRUE1
		@FALSE1:mov eax,2
		@TRUE1:imul eax,cxChar
		shr eax,1
		mov cxCaps,eax
		mov eax,tm.tmHeight
		add eax,tm.tmExternalLeading
		mov cyChar,eax
		invoke ReleaseDC,hWin,hDC
		mov eax,cxChar
		imul eax,40
		push eax
		mov eax,cxCaps
		imul eax,22
		pop edx
		add eax,edx
		mov iMaxWidth,eax;Save the width of three columns
	.elseif localMsg == WM_SIZE
		mov eax,lParam
		and eax,0ffffh
		mov cxClinet,eax
		mov eax,lParam
		shr eax,16
		clc
		and eax,0ffffh
		mov cyClinet,eax
		;Set vertical scroll bar range and page size
		mov scroll_info.cbSize,SIZE scroll_info
		mov scroll_info.fMask,SIF_RANGE or SIF_PAGE
		mov scroll_info.nMin,0
		mov scroll_info.nMax,NUMLINES - 1
		xor edx,edx
		mov eax,cyClinet
		cdq
		div cyChar
		mov scroll_info.nPage,eax
		invoke SetScrollInfo,hWin,SB_VERT,ADDR scroll_info,TRUE
		;Set horizontal scroll bar range and page size
		mov scroll_info.cbSize,SIZE scroll_info
		mov scroll_info.fMask,SIF_RANGE or SIF_PAGE
		mov scroll_info.nMin,0
		xor edx,edx
		mov eax,iMaxWidth
		cdq
		div cxChar
		add eax,2
		mov scroll_info.nMax,eax
		xor edx,edx
		mov eax,cxClinet
		cdq
		mov ebx,cxChar
		div ebx
		mov scroll_info.nPage,eax
		invoke SetScrollInfo,hWin,SB_HORZ,ADDR scroll_info,TRUE
	.elseif localMsg == WM_VSCROLL
		;Get all the vertical scroll bar information
		mov scroll_info.cbSize,SIZE scroll_info
		mov scroll_info.fMask,SIF_ALL
		invoke GetScrollInfo,hWin,SB_VERT,ADDR scroll_info
		;Save the position for comparison later on
		mov eax,scroll_info.nPos
		mov iVertPos,eax
		mov eax,wParam
		and eax,0ffffh
		.if eax == SB_TOP
			mov edx,scroll_info.nMin
			mov scroll_info.nPos,edx
		.elseif eax == SB_BOTTOM
			mov edx,scroll_info.nMax
			mov scroll_info.nPos,edx
		.elseif eax == SB_LINEUP
			dec scroll_info.nPos
		.elseif eax == SB_LINEDOWN
			inc scroll_info.nPos
		.elseif eax == SB_PAGEUP
			mov edx,scroll_info.nPos
			sub edx,scroll_info.nPage
			mov scroll_info.nPos,edx
		.elseif eax == SB_PAGEDOWN
			mov edx,scroll_info.nPos
			add edx,scroll_info.nPage
			mov scroll_info.nPos,edx
		.elseif eax == SB_THUMBTRACK
			mov edx,scroll_info.nTrackPos
			mov scroll_info.nPos,edx
		.else
			;break
		.endif
		;Set the position and then retrieve it.Due to adjustments
		;by Windows it may not be the same as the value set
		mov scroll_info.fMask,SIF_POS
		invoke SetScrollInfo,hWin,SB_VERT,ADDR scroll_info,TRUE
		invoke GetScrollInfo,hWin,SB_VERT,ADDR scroll_info
		;If the position has changed,scroll the window and update it
		mov eax,iVertPos
		.if eax != scroll_info.nPos
			sub eax,scroll_info.nPos
			imul eax,cyChar
			invoke ScrollWindow,hWin,0,eax,NULL,NULL
			invoke UpdateWindow,hWin
		.endif
	.elseif localMsg == WM_HSCROLL
		;Get all the vertical scroll bar information
		mov scroll_info.cbSize,SIZE scroll_info
		mov scroll_info.fMask,SIF_ALL
		;Save the position for comparison later on
		invoke GetScrollInfo,hWin,SB_HORZ,ADDR scroll_info
		mov eax,scroll_info.nPos
		mov iHorzPos,eax
		mov eax,wParam
		and eax,0ffffh
		.if eax == SB_LINELEFT
			dec scroll_info.nPos
		.elseif eax == SB_LINERIGHT
			inc scroll_info.nPos
		.elseif eax == SB_PAGELEFT
			mov edx,scroll_info.nPos
			sub edx,scroll_info.nPage
			mov scroll_info.nPos,edx
		.elseif eax == SB_PAGERIGHT
			mov edx,scroll_info.nPos
			add edx,scroll_info.nPage
			mov scroll_info.nPos,edx
		.elseif eax == SB_THUMBPOSITION
			mov edx,scroll_info.nTrackPos
			mov scroll_info.nPos,edx
		.else
			;break
		.endif
		;Set the position and then retrieve it.Due to adjustments
		;by Windows it may not be the same as the value set.
		mov scroll_info.fMask,SIF_POS
		Invoke SetScrollInfo,hWin,SB_HORZ,ADDR scroll_info,TRUE
		Invoke GetScrollInfo,hWin,SB_HORZ,ADDR scroll_info
		;If the position has changed,scroll the window
		mov eax,iHorzPos
		.if eax != scroll_info.nPos
			sub eax,scroll_info.nPos
			imul eax,cxChar
			invoke ScrollWindow,hWin,eax,0,NULL,NULL
		.endif
	.elseif localMsg == WM_KEYDOWN
		.if wParam == VK_HOME
			invoke SendMessage,hWin,WM_VSCROLL,SB_TOP,0
		.elseif wParam == VK_END
			invoke SendMessage,hWin,WM_VSCROLL,SB_BOTTOM,0
		.elseif wParam == VK_PRIOR
			invoke SendMessage,hWin,WM_VSCROLL,SB_PAGEUP,0
		.elseif wParam == VK_NEXT
			invoke SendMessage,hWin,WM_VSCROLL,SB_PAGEDOWN,0
		.elseif wParam == VK_UP
			invoke SendMessage,hWin,WM_VSCROLL,SB_LINEUP,0
		.elseif wParam == VK_DOWN
			invoke SendMessage,hWin,WM_VSCROLL,SB_LINEDOWN,0
		.elseif wParam == VK_LEFT
			invoke SendMessage,hWin,WM_HSCROLL,SB_PAGEUP,0
		.elseif wParam == VK_RIGHT
			invoke SendMessage,hWin,WM_HSCROLL,SB_PAGEDOWN,0
		.endif
	.elseif localMsg == WM_MOUSEWHEEL
		mov eax,wParam
		shr eax,16
		and eax,0ffffh
		cmp ax,0
		jl @TRUE2
		invoke SendMessage,hWin,WM_VSCROLL,SB_LINEUP,0
		jmp @j3
		@TRUE2:invoke SendMessage,hWin,WM_VSCROLL,SB_LINEDOWN,0
		@j3:
	.elseif localMsg == WM_DESTROY
		invoke PostQuitMessage,NULL
	.elseif localMsg == WM_CLOSE
		invoke PostQuitMessage,NULL
	.elseif localMsg == WM_PAINT
		invoke BeginPaint,hWin,ADDR ps
		mov hDC,eax
		;Get vertical scroll bar position
		mov scroll_info.cbSize,SIZE scroll_info
		mov scroll_info.fMask,SIF_POS
		Invoke GetScrollInfo,hWin,SB_VERT,ADDR scroll_info
		mov eax,scroll_info.nPos
		mov iVertPos,eax
		;Get horizontal scroll bar position
		invoke GetScrollInfo,hWin,SB_HORZ,ADDR scroll_info
		mov eax,scroll_info.nPos
		mov iHorzPos,eax
		;Find painting limits
		xor edx,edx
		mov eax,ps.rcPaint.top
		cdq
		div cyChar
		add eax,iVertPos
		cmp eax,0
		jg @vmax
		mov iPaintBeg,0
		jmp @j1
		@vmax:mov iPaintBeg,eax
		@j1:xor edx,edx
		mov eax,ps.rcPaint.bottom
		cdq
		div cyChar
		add eax,iVertPos
		cmp eax,NUMLINES - 1
		jl @vmin
		mov iPaintEnd,NUMLINES - 1
		jmp @j2
		@vmin:mov iPaintEnd,eax
		@j2:mov eax,iPaintBeg
		mov i,eax
		.WHILE eax<=iPaintEnd
			mov eax,1
			sub eax,iHorzPos
			imul eax,cxChar
			mov x,eax
			mov eax,i
			sub eax,iVertPos
			imul eax,cyChar
			mov y,eax
			mov ecx,i
			imul ecx,ecx,SIZE SYSMET
			mov edx,OFFSET szSysmetrics.szLabel
			add edx,ecx
			push edx;指向szSysmetrics.szLabel的指针
			invoke Str_length,edx
			pop edx
			invoke TextOut,hDC,x,y,edx,eax
			mov ecx,i
			imul ecx,ecx,SIZE SYSMET
			mov edx,OFFSET szSysmetrics.szDesc
			add edx,ecx
			push edx;指向szSysmetrics.szDesc的指针
			invoke Str_length,edx
			push eax;szSysmetrics.szDesc的长度
			mov eax,cxCaps
			imul eax,22
			add eax,x
			pop ecx
			pop edx
			invoke TextOut,hDC,eax,y,edx,ecx
			invoke SetTextAlign,hDC,TA_RIGHT or TA_TOP
			mov ecx,i
			imul ecx,ecx,SIZE SYSMET
			mov edx,OFFSET szSysmetrics.iIndex
			add edx,ecx
			invoke GetSystemMetrics,[edx]
			invoke wsprintf,ADDR szBuffer,CTEXT("%5d"),eax
			push eax
			mov eax,cxCaps
			imul eax,22
			push eax
			mov eax,cxChar
			imul eax,40
			pop edx
			add eax,edx
			add eax,x
			pop ecx
			lea edx,szBuffer
			invoke TextOut,hDC,eax,y,edx,ecx
			invoke SetTextAlign,hDC,TA_LEFT or TA_TOP
			inc i
			mov eax,i
		.ENDW
		invoke EndPaint,hWin,ADDR ps
	.else
		invoke DefWindowProc,hWin,localMsg,wParam,lParam
		ret
	.endif
	xor eax,eax
	ret
WndProc endp